package com.ruoyi.mes.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mes.mapper.ProceMtrMapper;
import com.ruoyi.mes.domain.ProceMtr;
import com.ruoyi.mes.service.IProceMtrService;

/**
 * 工序原料Service业务层处理
 *
 * @author LongAndHao
 * @date 2023-04-04
 */
@Service
public class ProceMtrServiceImpl implements IProceMtrService
{
    @Autowired
    private ProceMtrMapper proceMtrMapper;

    /**
     * 查询工序原料
     *
     * @param id 工序原料主键
     * @return 工序原料
     */
    @Override
    public ProceMtr selectProceMtrById(Long id)
    {
        return proceMtrMapper.selectProceMtrById(id);
    }

    /**
     * 查询工序原料列表
     *
     * @param proceMtr 工序原料
     * @return 工序原料
     */
    @Override
    public List<ProceMtr> selectProceMtrList(ProceMtr proceMtr)
    {
        return proceMtrMapper.selectProceMtrList(proceMtr);
    }

    /**
     * 新增工序原料
     *
     * @param proceMtr 工序原料
     * @return 结果
     */
    @Override
    public int insertProceMtr(ProceMtr proceMtr)
    {
        proceMtr.setCreateTime(DateUtils.getNowDate());
        return proceMtrMapper.insertProceMtr(proceMtr);
    }

    /**
     * 修改工序原料
     *
     * @param proceMtr 工序原料
     * @return 结果
     */
    @Override
    public int updateProceMtr(ProceMtr proceMtr)
    {
        proceMtr.setUpdateTime(DateUtils.getNowDate());
        return proceMtrMapper.updateProceMtr(proceMtr);
    }

    /**
     * 批量删除工序原料
     *
     * @param ids 需要删除的工序原料主键
     * @return 结果
     */
    @Override
    public int deleteProceMtrByIds(Long[] ids)
    {
        return proceMtrMapper.deleteProceMtrByIds(ids);
    }

    /**
     * 删除工序原料信息
     *
     * @param id 工序原料主键
     * @return 结果
     */
    @Override
    public int deleteProceMtrById(Long id)
    {
        return proceMtrMapper.deleteProceMtrById(id);
    }

    /**
     * 根据工艺编码、工序id删除原料
     * @param tecCode
     * @param proceId
     * @return
     */
    @Override
    public int deleteMtrsBtTecAndProce(String tecCode, Long proceId) {
        return proceMtrMapper.deleteMtrsBtTecAndProce(tecCode,proceId);
    }


}
